
enum OsnMessageStatus: Int {
    case Sending = 0
    case Sent = 1
    case Send_Failure = 2
    case Mentioned = 3
    case AllMentioned = 4
    case Unread = 5
    case Readed = 6
    case Played = 7
    case Opened = 8
    case Recall = 9
    
    init(rawValue: Int) {
        switch rawValue {
        case 0: self = .Sending
        case 1: self = .Sent
        case 2: self = .Send_Failure
        case 3: self = .Mentioned
        case 4: self = .AllMentioned
        case 5: self = .Unread
        case 6: self = .Readed
        case 7: self = .Played
        case 8: self = .Opened
        case 9: self = .Recall
        default: self = .Sending
        }
    }
}
enum OsnMessageDirection: Int {
    case Send = 0
    case Receive
    
    init(rawValue: Int) {
        switch rawValue {
        case 0: self = .Send
        case 1: self = .Receive
        default: self = .Send
        }
    }
}
class DMCCMessage {
    var id: Int64 = 0
    var target = ""
    var originalUser = ""
    var toUsers = ""
    var direction = OsnMessageDirection.Send
    var status = OsnMessageStatus.Sending
    var timestamp:Int64 = 0
    var extra = ""
    var msgHash = ""
    var msgHasho = ""
    var msgType = OsnMessageContentType.text
    var content:Any? = nil
    var uiData:Any = ""
    var text:String = ""
//    var content = OsnMessageContent()
    
    var showTime = false
    var msgCellHeight = 0
    var msgCellWidth = 0
    var msgDigestHeight = 0
    
    var groupInfo = DMCCGroup()
//    var digest = ""
    
//    func digest () {
//        if content != nil {
//            return content
//        }
//    }
    
    func getFrom()->String{
        if direction == OsnMessageDirection.Receive{
            return target
        }else{
            return originalUser
        }
    }
}
